﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace NCS.IConnect.Core.WebApi.Configuration
{
    /// <summary>
    /// The <see cref="ConfigurationElement"/> to configure authorization settings for web api.
    /// </summary>
    [ComVisible(false)]
    public class AuthorizationElement : ConfigurationElement
    {
        private const string RoleToReadDataPropertyName = "roleToReadData";
        private const string RoleToWriteDataPropertyName = "roleToWriteData"; 
        private const string BusinessActionToReadDataPropertyName = "businessActionToReadData";
        private const string BusinessActionToWriteDataPropertyName = "businessActionToWriteData"; 
        private const string AuthorizationRuleToReadDataPropertyName = "authorizationRuleToReadData";
        private const string AuthorizationRuleToWriteDataPropertyName = "authorizationRuleToWriteData";

        /// <summary>
        /// The role which is authorized to read iConnect.NET internal data.
        /// </summary>
        public string RoleToReadData
        {
            get { return base[RoleToReadDataPropertyName] as string; }
        }

        /// <summary>
        /// The role which is authorized to write iConnect.NET internal data.
        /// </summary>
        public string roleToWriteData
        {
            get { return base[RoleToWriteDataPropertyName] as string; }
        }

        /// <summary>
        /// The business action which is authorized to read iConnect.NET internal data.
        /// </summary>
        public string BusinessActionToReadData
        {
            get { return base[BusinessActionToReadDataPropertyName] as string; }
        }

        /// <summary>
        /// The business action which is authorized to write iConnect.NET internal data.
        /// </summary>
        public string BusinessActionToWriteData
        {
            get { return base[BusinessActionToWriteDataPropertyName] as string; }
        }

        /// <summary>
        /// The authorization rule which is authorized to read iConnect.NET internal data.
        /// </summary>
        public string AuthorizationRuleToReadData
        {
            get { return base[AuthorizationRuleToReadDataPropertyName] as string; }
        }

        /// <summary>
        /// The authorization rule which is authorized to write iConnect.NET internal data.
        /// </summary>
        public string AuthorizationRuleToWriteData
        {
            get { return base[AuthorizationRuleToWriteDataPropertyName] as string; }
        }
    }
}
